var spare = new Array(3);
var dense = Array.apply(null,spare);
console.log(spare);
console.log(dense);

spare[1]="zhangsan";
dense[1] = "zhangsan1";
for(index in spare){
    console.log(index,spare[index]);
    
}

for(index in dense){
    console.log(index,dense[index]);
    
}

console.log("---------------------");
console.log(Array.prototype);


var arr = [1,3,2,5];
console.log(arr.valueOf());
console.log(arr.toString());

arr.toString = function(){
    return arr[0];
}
console.log(arr.toString());

var p1={
    toLocaleString:function(){
        return "p1 toLocaleString";
    },
    toString:function(){
        return "p1 toString"
    }
}

var p2={
    toLocaleString:function(){
        return "p2 toLocaleString";
    },
    toString:function(){
        return "p2 toString"
    }
}

var person = [p1,p2];
console.log(person);
console.log(person.toLocaleString());
console.log(person.toString());


